package com.chaucer.demo.datasource;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @Description TODO
 * @Author Chaucer
 * @Date 2021/9/2 16:19
 */
public class MultiDataSource extends AbstractRoutingDataSource {
    private RouteChoose chooser;
    public MultiDataSource(RouteChoose chooser) {
        this.chooser = chooser;
    }

    @Override
    protected Object determineCurrentLookupKey() {
        return chooser.routeKey();
    }
}